const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports =
{
    entry:
    {
        'index': path.resolve(__dirname + '/src/js/index.js')
    },
    output: {
        path: path.resolve(__dirname + '/src/views/js'),
        filename: '[name].js'
    },
    resolve: {
        alias: {
            vue: 'vue/dist/vue.js'
        }
    },
    externals: {

    },
    module: {
        loaders: [
            {
                test: /\.vue$/,
                loader: 'babel-loader!vue-loader',
                exclude: /node_modules/
            },
            {
                test: /\.js$/,
                loader: 'babel-loader',
                query: {compact: true},
                exclude: /node_modules/
            },
            {
                test: /\.css$/,
                loader: 'css-loader!style-loader'
            },
            {
                test: /\.(eot|woff|woff2|svg|ttf)([\?]?.*)$/,
                loader: 'file-loader'
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            filename: path.resolve(__dirname + '/src/views/index.html'),
            template: path.resolve(__dirname + '/src/template/index.html'),
            inject: 'body',
            hash: true,
            chunks: ['index']
        })
    ]
}
